<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{ title }}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="{{ url_for('static',filename='css/font.css') }}">
    <link rel="stylesheet" href="{{ url_for('static',filename='css/xadmin.css') }}">
    <link rel="stylesheet" href="{{ url_for('static',filename='css/swiper.min.css') }}">
    <script type="text/javascript" src="{{ url_for('static',filename='js/jquery.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static',filename='js/swiper.js') }}"></script>
    <script src="{{ url_for('static',filename='lib/layui/layui.js') }}" charset="utf-8"></script>
    <script type="text/javascript" src="{{ url_for('static',filename='js/xadmin.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static',filename='js/public.js') }}"></script>
</head>
<body>
<div class="login-logo"><h1>{{ title }}</h1></div>
<div class="login-box">
    <form class="layui-form layui-form-pane" action="">
        <h3>登录管理中心</h3>
        <label class="login-title">帐号</label>
        <div class="layui-form-item">
            <label class="layui-form-label login-form"><i class="iconfont">&#xe6b8;</i></label>
            <div class="layui-input-inline login-inline">
                <input type="text" name="username" placeholder="请输入你的帐号" autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <label class="login-title">密码</label>
        <div class="layui-form-item">
            <label class="layui-form-label login-form"><i class="iconfont">&#xe82b;</i></label>
            <div class="layui-input-inline login-inline">
                <input type="password" name="password" placeholder="请输入你的密码" autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="form-actions">
            <button class="btn btn-warning pull-right" lay-submit lay-filter="login" type="submit">登录</button>
        </div>
    </form>
</div>
<script>
    $(function () {
        layui.use('form', function () {
            var form = layui.form();
            form.on('submit(login)', function (data) {
                $.ajax({
                    type: 'POST',
                    data: data.field,
                    dataType: 'json',
                    success: function (data) {
                        if (data.status === 0) {
                            layer.msg(data.message, {icon: 1, time: 1000});
                            location.href = "{{ url_for('cms_bp.sys_frame') }}";
                        } else {
                            layer.msg(data.message, {icon: 2, time: 2000});
                        }
                    }
                });
                return false;
            });
        });
    })

</script>
</body>
</html>